const { UnusedFilesWebpackPlugin } = require("unused-files-webpack-plugin");
const webpack = require("webpack");

module.exports = [
  new webpack.DefinePlugin({
    // 注意：如果和package.json中 --mode 同名的 key，这里的值会覆盖mode配置的值
    "process.env.NODE_ENV": JSON.stringify(process.env.NODE_ENV),
  }),
  new UnusedFilesWebpackPlugin({
    patterns: ["projects/khfw-pc/**/*.*", "projects/common/**/*.*"],
    globOptions: {
      ignore: [
        "node_modules/**/*",
        "**/node_modules/**/*",
        "projects/common/components/**/*.*",
        "projects/common/scripts/**/*.*",
        "projects/common/moduleComp/interaction-player/ai-voice/js/transcode.worker.js",
        "**/public/**/*.*",
        "**/config/**/*.*",
        "**/*.config.js",
        "**/*.json",
        "**/*.md"
      ]
    }
  })
]
